//
//  listViewController.m
//  ziLu_ios
//
//  Created by mac on 16/3/2.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "listViewController.h"

@interface listViewController ()

@end

@implementation listViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //左侧按钮
    UIButton *leftButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 7, 18, 10)];
    [leftButton setBackgroundImage:[UIImage imageNamed:@"1a"] forState:UIControlStateNormal];
    [leftButton addTarget:self action:@selector(chouTi) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftButton];
    self.navigationItem.leftBarButtonItem = leftBarButtonItem;
    
    //右侧按钮
    UIBarButtonItem *right = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"1a"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ] style:UIBarButtonItemStylePlain target:self action:@selector(back)];
    self.navigationItem.rightBarButtonItem = right;
    
    //把传递过来的图片当成背景
    UIImageView *imaeView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, MAIN_WIDTH , MAIN_HEIGHT)];
    imaeView.image =self.image;
    [self.view addSubview:imaeView];
    
    
    CIContext *context = [CIContext contextWithOptions:nil];
    CIImage *inputImage = [[CIImage alloc] initWithImage:self.image];
    // create gaussian blur filter
    CIFilter *filter = [CIFilter filterWithName:@"CIGaussianBlur"];
    [filter setValue:inputImage forKey:kCIInputImageKey];
    [filter setValue:[NSNumber numberWithFloat:10.0] forKey:@"inputRadius"];
    // blur image
    CIImage *result = [filter valueForKey:kCIOutputImageKey];
    CGImageRef cgImage = [context createCGImage:result fromRect:[result extent]];
    UIImage *image = [UIImage imageWithCGImage:cgImage];
    CGImageRelease(cgImage);
    imaeView.image = image;
    
    
   
    // Do any additional setup after loading the view.
}
-(void)back{
    //返回上衣页面
    [self dismissViewControllerAnimated:YES completion:^{
        
    }];
}
-(void)chouTi{

    AppDelegate *delegate=(AppDelegate*)[[UIApplication sharedApplication]delegate];
    YRSideViewController *sideViewController=[delegate sideViewController];
    
    [sideViewController showLeftViewController:true];
    
    //[sideViewController setNeedSwipeShowMenu:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
